var BASE_URL = 'http://jinzhidata.com/v2'

$(function () {
    // 加载报告/资料 todo 此处一次性加载所有的，待修改
    $.ajax({
        url: BASE_URL + "/resource/list/buy",
        type: "get",
        contentType: 'application/json',
        dataType: "json",
        success: function (response) {
            if (response.code === 0 && response.data.length !== 0) {
                var data = response.data
                var html = '';
                for (var i = 0; i < data.length; i++) {
                    var item = data[i]
                    html += '<div class="zhul_sy_zyList clearfix">'
                    html += '   <div class="zhul_nzy_limg">'
                    html += '       <a href="' + BASE_URL + "/pc/resource.html?resourceId=" + item.resourceId + '" title="' + item.resourceName + '" target="_blank">'
                    html += '           <img src="/img/' + item.resourceCover + '" title="' + item.resourceName + '"/>'
                    html += '       </a>'
                    html += '   </div>'
                    html += '   <div class="zhul_nzy_rinfo">'
                    html += '       <div class="zhul_zy_rtop">'
                    html += '           <h3 class="zhul_zy_rtit">'
                    html += '               <a href="' + BASE_URL + "/pc/resource.html?resourceId=" + item.resourceId + '" target="_blank" title="' + item.resourceName + '">' + item.resourceName + '</a>'
                    html += '           </h3>'
                    html += '           <p class="zhul_zy_hot2">'
                    html += '               <a href="#" target="_self" title="积分">' + item.resourcePrice + '</a> '
                    html += '           </p>'
                    html += '       </div>'
                    html += '       <p class="zhul_zy_fbdate" style="width:auto;">'
                    html += '           <span class="zhul_sy_headerBox zhul_pop_parent" uid="0">' + item.resourceAuthorName + '</span>&nbsp;&nbsp;发表于' + formatTime(item.createTime, "yyyy-MM-dd") + '&nbsp;&nbsp;'
                    // html += '           <img src="/img/pubimg/n_star_i_3.png">&nbsp;'
                    html += '       </p>'
                    html += '       <p class="zhul_zy_ltcon2">' + item.resourceIntroduction + '</p>'
                    html += '   </div>'
                    html += '</div>'
                }
            }
            $(".resource_list").html(html)
        }
    })

})
